/*
 * $Id$
 */

package corejs.expr;

import corejs.rt.Value;

/**
 *
 * @author pengyu
 */
public class RefinementExpr 
   extends BinaryOperatorExpr implements Assignable {

   public RefinementExpr(final Expression left, final Expression right) {
      super(left, right);
   }
   
   public static RefinementExpr dot(final Expression left, final Expression right) {
      final RefinementExpr expr = new RefinementExpr(left, right);
      expr._right = new StringExpr(((NameExpr)expr._right).name());
      return expr;
   }

   @Override
   public Value acceptAssignment(final ExpressionVisitor v, final Expression e) {
      return v.visitAssignment(this, e);
   }

   public Value acceptRefinement(final ExpressionVisitor v) {
      return _right.accept(v);
   }

   @Override
   public Value accept(final ExpressionVisitor visitor) {
      return visitor.visitRefinement(_left, _right);
   }
}
